package Taoteng_desktop.cs;

/** 
 Class1 ��ժҪ˵����
*/
public class upDataset2DB
{
	public upDataset2DB()
	{
		//
		// TODO: �ڴ˴���ӹ��캯���߼�
		//
	}
	public static DataSet UpdateByDataSet(DataSet ds, String strTblName)
	{
		 return UpdateByDataSet(ds, strTblName, MOLE.SQL.connectionString);
//			MOLE.SQL.c
//			 
//			return new DataSet();
	}
	public static DataSet UpdateByDataSet(DataSet ds, String strTblName, String strConnection)
	{
		SqlConnection conn = new SqlConnection(strConnection);
		SqlDataAdapter myAdapter = new SqlDataAdapter();
		SqlCommand myCommand = new SqlCommand("select * from " + strTblName,(SqlConnection) conn);
		myAdapter.SelectCommand = myCommand;
		SqlCommandBuilder myCommandBuilder = new SqlCommandBuilder(myAdapter);
		try

		{

			//lock(this)            //����������(�ֲ�ʽ���)

			{

				myAdapter.Update(ds,"ds");

			}

		}

		catch (RuntimeException err)
		{

			conn.Close();
			//throw new BusinessException(err);
			throw new RuntimeException(err.getMessage());
		}

		return ds; //���ݼ�����״̬�ڸ��º�ᶼ��Ϊ: UnChange,����θ��º�ͻ���Ҫ�÷��ص�ds

	}

}